# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContainerAnalysis.V1.Model.Detail do
  @moduledoc """
  A detail for a distro and package affected by this vulnerability and its associated fix (if one is available).

  ## Attributes

  *   `affectedCpeUri` (*type:* `String.t`, *default:* `nil`) - Required. The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability affects.
  *   `affectedPackage` (*type:* `String.t`, *default:* `nil`) - Required. The package this vulnerability affects.
  *   `affectedVersionEnd` (*type:* `GoogleApi.ContainerAnalysis.V1.Model.Version.t`, *default:* `nil`) - The version number at the end of an interval in which this vulnerability exists. A vulnerability can affect a package between version numbers that are disjoint sets of intervals (example: [1.0.0-1.1.0], [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be represented in its own Detail. If a specific affected version is provided by a vulnerability database, affected_version_start and affected_version_end will be the same in that Detail.
  *   `affectedVersionStart` (*type:* `GoogleApi.ContainerAnalysis.V1.Model.Version.t`, *default:* `nil`) - The version number at the start of an interval in which this vulnerability exists. A vulnerability can affect a package between version numbers that are disjoint sets of intervals (example: [1.0.0-1.1.0], [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be represented in its own Detail. If a specific affected version is provided by a vulnerability database, affected_version_start and affected_version_end will be the same in that Detail.
  *   `description` (*type:* `String.t`, *default:* `nil`) - A vendor-specific description of this vulnerability.
  *   `fixedCpeUri` (*type:* `String.t`, *default:* `nil`) - The distro recommended [CPE URI](https://cpe.mitre.org/specification/) to update to that contains a fix for this vulnerability. It is possible for this to be different from the affected_cpe_uri.
  *   `fixedPackage` (*type:* `String.t`, *default:* `nil`) - The distro recommended package to update to that contains a fix for this vulnerability. It is possible for this to be different from the affected_package.
  *   `fixedVersion` (*type:* `GoogleApi.ContainerAnalysis.V1.Model.Version.t`, *default:* `nil`) - The distro recommended version to update to that contains a fix for this vulnerability. Setting this to VersionKind.MAXIMUM means no such version is yet available.
  *   `isObsolete` (*type:* `boolean()`, *default:* `nil`) - Whether this detail is obsolete. Occurrences are expected not to point to obsolete details.
  *   `packageType` (*type:* `String.t`, *default:* `nil`) - The type of package; whether native or non native (e.g., ruby gems, node.js packages, etc.).
  *   `severityName` (*type:* `String.t`, *default:* `nil`) - The distro assigned severity of this vulnerability.
  *   `source` (*type:* `String.t`, *default:* `nil`) - The source from which the information in this Detail was obtained.
  *   `sourceUpdateTime` (*type:* `DateTime.t`, *default:* `nil`) - The time this information was last changed at the source. This is an upstream timestamp from the underlying information source - e.g. Ubuntu security tracker.
  *   `vendor` (*type:* `String.t`, *default:* `nil`) - The name of the vendor of the product.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :affectedCpeUri => String.t() | nil,
          :affectedPackage => String.t() | nil,
          :affectedVersionEnd => GoogleApi.ContainerAnalysis.V1.Model.Version.t() | nil,
          :affectedVersionStart => GoogleApi.ContainerAnalysis.V1.Model.Version.t() | nil,
          :description => String.t() | nil,
          :fixedCpeUri => String.t() | nil,
          :fixedPackage => String.t() | nil,
          :fixedVersion => GoogleApi.ContainerAnalysis.V1.Model.Version.t() | nil,
          :isObsolete => boolean() | nil,
          :packageType => String.t() | nil,
          :severityName => String.t() | nil,
          :source => String.t() | nil,
          :sourceUpdateTime => DateTime.t() | nil,
          :vendor => String.t() | nil
        }

  field(:affectedCpeUri)
  field(:affectedPackage)
  field(:affectedVersionEnd, as: GoogleApi.ContainerAnalysis.V1.Model.Version)
  field(:affectedVersionStart, as: GoogleApi.ContainerAnalysis.V1.Model.Version)
  field(:description)
  field(:fixedCpeUri)
  field(:fixedPackage)
  field(:fixedVersion, as: GoogleApi.ContainerAnalysis.V1.Model.Version)
  field(:isObsolete)
  field(:packageType)
  field(:severityName)
  field(:source)
  field(:sourceUpdateTime, as: DateTime)
  field(:vendor)
end

defimpl Poison.Decoder, for: GoogleApi.ContainerAnalysis.V1.Model.Detail do
  def decode(value, options) do
    GoogleApi.ContainerAnalysis.V1.Model.Detail.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ContainerAnalysis.V1.Model.Detail do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
